package widget.dialog;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.RelativeLayout;

import net.ck.hzq.R;

public class ChangeBankDialog extends MyDialog implements View.OnClickListener {

    private static final String TAG = "SetPwdDialog";

    private String title;
    private Context mContext;
    private DialogCallback callback;
    private RelativeLayout grouplayout;


    public ChangeBankDialog(@NonNull Context context, String title, DialogCallback callback) {
        this(context, R.style.MyDialog, title, callback);
    }

    public ChangeBankDialog(@NonNull Context context, int themeResId, String title, DialogCallback callback) {
        super(context, themeResId);
        this.title = title;
        mContext = context;
        this.callback = callback;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG, "onCreate: ");
        initView();
    }

    private void initView() {
        setContentView(R.layout.dialog_changebank_set);
        // 设置窗口大小
        WindowManager windowManager = getWindow().getWindowManager();
        int screenWidth = windowManager.getDefaultDisplay().getWidth();
        int screenHeight = windowManager.getDefaultDisplay().getHeight();
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
//        attributes.alpha = 0.3f;
        attributes.width = screenWidth;
        attributes.height = screenHeight;
        attributes.gravity = Gravity.CENTER;
        getWindow().setAttributes(attributes);
        setCancelable(true);
        grouplayout = findViewById(R.id.grouplayout);
        grouplayout.setOnClickListener(this);
    }


    public void setTitle(String title) {
        this.title = title;
    }

    public void setCallback(DialogCallback callback) {
        this.callback = callback;
    }

    @Override
    public void dismiss() {
        super.dismiss();
    }

    @Override
    public void onClick(View v) {
        dismiss();
    }

}
